package constants;
//This is a sort of enum.
//It defines the general format of the valid network messages.
public class PROTOCOL
	{
	//The lengths of the messages.
	public final static int[] LEN = new int[23];
	//The integer values of the messages.
	public final static int ROOM 			= 0;//<0|roomID|roomName|roomSize>
	public final static int DEPARTMENT 		= 1;//<1|departmentID|departmentName>
	public final static int PERSON 			= 2;//<2|personID|email|password|realName|department>
	public final static int APPOINTMENT 	= 3;//<3|personID|appointmentID|startTime|endTime|subject|description|roomID|locationName|changeToID|changedFromID|isCancelled>
	public final static int MESSAGE 		= 4;//<4|type|topersonID|messageID|ownerPersonID|appointmentID|auxField|optionalString|timeStamp>

	public final static int DEL_ROOM 		= 5;//<5|roomID>
	public final static int DEL_DEPARTMENT 	= 6;//<6|departmentID>
	public final static int DEL_PERSON	 	= 7;//<7|personID>
	public final static int DEL_APPOINTMENT = 8;//<8|personID|appointmentID|reason>
	public final static int DEL_MESSAGE		= 9;//<9|personID|messageID>
	
	public final static int LOGIN_ATTEMPT 	= 10;//<10|email|password>
	public final static int LOGIN_ACCEPT 	= 11;//<11|personID|highestAppointmentID>
	public final static int LOGIN_ERROR 	= 12;//<12>
	
	public final static int SET_ATTENDANCE	= 13;//<13|ownerPersonID|appointmentID|personID|type|reason>
	
	public final static int ACCESS_RANGE	= 14;//<14|startTime|endTime>
	public final static int ACCESS_PERSON	= 15;//<15|someParticipantPersonID>
	public final static int ACK_APPOINTMENTS= 16;//<16|type(0=range,1=specific)>
	public final static int GET_APPOINTMENT = 17;//<17|ownerPersonID|appointmentID>
	public final static int UNSET_PERSON 	= 18;//<18|personID>
	public final static int UNSET_SPECIFIC 	= 19;//<19>
	
	public final static int CHECK_ROOM 		= 20;//<20,roomID,fromTime(to server)/isavailable(to client)|,toTime(to server)/-1(to client),Except ownerID/-1(to client),Except appID/-1(to client)>
	public final static int POKE 			= 21;//<21>
	public final static int APPOINTMENT_OK 	= 22; //<22,isOK>
	
	static
		{
		LEN[ROOM] 				= 4;
		LEN[DEPARTMENT] 		= 3;
		LEN[PERSON] 			= 6;
		LEN[APPOINTMENT] 		= 12;
		LEN[MESSAGE] 			= 9;
		LEN[DEL_ROOM] 			= 2;
		LEN[DEL_DEPARTMENT] 	= 2;
		LEN[DEL_PERSON] 		= 2;
		LEN[DEL_APPOINTMENT] 	= 4;
		LEN[DEL_MESSAGE] 		= 3;
		LEN[LOGIN_ATTEMPT] 		= 3;
		LEN[LOGIN_ACCEPT] 		= 3;
		LEN[LOGIN_ERROR] 		= 1;
		LEN[SET_ATTENDANCE] 	= 6;
		LEN[ACCESS_RANGE] 		= 3;
		LEN[ACCESS_PERSON] 		= 2;
		LEN[ACK_APPOINTMENTS] 	= 2;
		LEN[GET_APPOINTMENT] 	= 3;
		LEN[UNSET_PERSON] 		= 2;
		LEN[UNSET_SPECIFIC] 	= 1;
		LEN[CHECK_ROOM] 		= 6;
		LEN[POKE] 				= 1;
		LEN[APPOINTMENT_OK]		= 2;
		}
	}
